package com.powernode.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.powernode.shop.domain.ProdComm;
import com.powernode.shop.service.ProdCommService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZHAOZHENYU
 * @since 2022/10/26
 */
@RestController
@RequestMapping("/prod/prodComm")
public class ProdCommController {

    @Autowired
    private ProdCommService prodCommService;

    /**
     * 1、分页查询评论
     * @param page
     * @param prodComm
     * @return
     */
    @PreAuthorize("hasAuthority('prod:prodComm:page')")
    @GetMapping("/page")
    public ResponseEntity<Page<ProdComm>> loadProdCommPage(Page<ProdComm> page, ProdComm prodComm){
        Page<ProdComm> prodCommPage = prodCommService.selectProdComm(page,prodComm);
        return ResponseEntity.ok(prodCommPage);
    }


}
